package com.shensi.adminCollect.controller.station;

import com.shensi.common.core.domain.AjaxResult;
import com.shensi.adminCollect.domain.station.PayOrder;
import com.shensi.adminCollect.service.station.IPayOrderAllService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Objects;

@RestController
@RequestMapping("/payOrderAll")
public class PayOrderAllController {

    @Autowired
    private IPayOrderAllService payOrderAllService;

    @PostMapping("/add")
    public AjaxResult addPayOrderAll(@RequestBody PayOrder payOrder){
        if(Objects.isNull(payOrder)){
            return AjaxResult.success("请求参数异常");
        }
        payOrderAllService.addPayOrder(payOrder);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult updatePayOrderAll(@RequestBody PayOrder payOrder){
        if(Objects.isNull(payOrder)){
            return AjaxResult.success("请求参数异常");
        }
        payOrderAllService.updatePayOrder(payOrder);
        return AjaxResult.success();
    }

    @GetMapping("/refresh")
    public AjaxResult refresh(){
        payOrderAllService.addNewPayOrder();
        return AjaxResult.success();
    }
}
